home *** CD-ROM | disk | FTP | other *** search
- /*
- File: LetterLog.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __LETTERLOG__
- #define __LETTERLOG__
-
- #ifndef __DISKLOG__
- #include "DiskLog.h"
- #endif
-
- #ifndef __OCEOBJECTS__
- #include "OCEObjects.h"
- #endif
-
- #ifndef __LETTER__
- #include "Letter.h"
- #endif
-
- #ifndef __RECIPIENT__
- #include "Recipient.h"
- #endif
-
- class TLetter;
- class TLetterLogEntry;
-
- #pragma push
- #pragma segment LetterLog
-
- /***********************************|****************************************/
-
- class TLetterLog : public TDiskLog
- {
- public: TLetterLog ( const TFileSpec&, TPurgeCriteria* = nil );
- virtual ~TLetterLog ();
-
- virtual Boolean AddLetter ( const TLetter* );
- virtual TLetterLogEntry* CreateLetterEntry ( EntryIndex );
-
- // use the iterators and enumerators below to access entries in a letter log
- // else use the remaining public methods in TDiskLog, except for those made protected below
-
- protected:
-
- virtual TLogEntry* ReconstructEntryFromInfoAtCurrentMark ();
- virtual Boolean AddEntry ( TLogEntry& ); // call AddLetterEntry instead
- virtual TLogEntry* CreateEntry ( EntryIndex ); // call CreateEntry instead
- };
-
- extern TLetterLog* gBovineLetterLog;
-
- /***********************************|****************************************/
-
- class TLetterLogEntry : public TLogEntry
- {
- public: TLetterLogEntry ();
- TLetterLogEntry ( const TLetter& );
- virtual ~TLetterLogEntry ();
-
- enum LetterStatus { kCompleted, kNotCompleted, kUnknown };
-
- virtual Boolean WriteTo ( TAbstractFile& ) const;
- virtual Boolean ReadFrom ( TAbstractFile& );
-
- virtual unsigned long GetTextLength () const;
- virtual void GetText ( char* buffer, unsigned long maxBufferSize ) const;
- virtual char* CreateText () const;
-
- virtual ostream& operator >> ( ostream& ) const;
-
- friend class TLetterLogWindow ;
-
- protected: Boolean GetRecipientName ( const TLetter&, RecipientTypeSet type, unsigned short index, TRString& ) const;
- Boolean GetSubject ( const TLetter&, TRString& ) const;
- const char* GetClass () const; // all subclasses must override
- LetterStatus DetermineLetterStatus ( const TLetter& ) const;
-
- private: BLJLetterID fID;
- TRString fSender;
- TRString fSubject;
- BLJTime fTime;
- LetterStatus fStatus;
- TRString fMessage;
- };
-
- /***********************************|****************************************/
-
- class TLetterLogEnumerator
- {
- public: TLetterLogEnumerator ( TLetterLog& );
- virtual ~TLetterLogEnumerator ();
-
- unsigned long CountEntries () const;
-
- const TLetterLogEntry* GetEntryByIndex ( unsigned long );
- TLetterLogEntry* AdoptEntryByIndex ( unsigned long );
-
- const TLetterLogEntry* GetEntryByLogID ( unsigned long );
- TLetterLogEntry* AdoptEntryByLogID ( unsigned long );
-
- private: TLetterLogEnumerator ();
- TLetterLogEnumerator& operator = ( const TLetterLogEnumerator& );
-
- TDiskLogEnumerator fImplementation;
- };
-
- /***********************************|****************************************/
-
- class TLetterLogIterator
- {
- public: TLetterLogIterator ( TLetterLog& );
- virtual ~TLetterLogIterator ();
-
- const TLetterLogEntry* GetFirstEntry ();
- TLetterLogEntry* AdoptFirstEntry ();
-
- const TLetterLogEntry* GetNextEntry ();
- TLetterLogEntry* AdoptNextEntry ();
-
- const TLetterLogEntry* GetLastEntry ();
- TLetterLogEntry* AdoptLastEntry ();
-
- const TLetterLogEntry* GetPreviousEntry ();
- TLetterLogEntry* AdoptPreviousEntry ();
-
- private: TLetterLogIterator ( const TLetterLogIterator& );
- TLetterLogIterator& operator = ( const TLetterLogIterator& );
-
- TDiskLogIterator fImplementation;
- };
-
- /***********************************|****************************************/
-
- inline unsigned long TLetterLogEnumerator::CountEntries () const { return fImplementation.CountEntries (); }
- inline const TLetterLogEntry* TLetterLogEnumerator::GetEntryByIndex ( unsigned long index ) { return (const TLetterLogEntry*) fImplementation.GetEntryByIndex ( index ); }
- inline TLetterLogEntry* TLetterLogEnumerator::AdoptEntryByIndex ( unsigned long index ) { return (TLetterLogEntry*) fImplementation.AdoptEntryByIndex ( index ); }
- inline const TLetterLogEntry* TLetterLogEnumerator::GetEntryByLogID ( unsigned long id ) { return (const TLetterLogEntry*) fImplementation.GetEntryByID ( id ); }
- inline TLetterLogEntry* TLetterLogEnumerator::AdoptEntryByLogID ( unsigned long id ) { return (TLetterLogEntry*) fImplementation.AdoptEntryByID ( id ); }
- inline const TLetterLogEntry* TLetterLogIterator::GetFirstEntry () { return (const TLetterLogEntry*) fImplementation.GetFirstEntry (); }
- inline TLetterLogEntry* TLetterLogIterator::AdoptFirstEntry () { return (TLetterLogEntry*) fImplementation.AdoptFirstEntry (); }
- inline const TLetterLogEntry* TLetterLogIterator::GetNextEntry () { return (const TLetterLogEntry*) fImplementation.GetNextEntry (); }
- inline TLetterLogEntry* TLetterLogIterator::AdoptNextEntry () { return (TLetterLogEntry*) fImplementation.AdoptNextEntry (); }
- inline const TLetterLogEntry* TLetterLogIterator::GetLastEntry () { return (const TLetterLogEntry*) fImplementation.GetLastEntry (); }
- inline TLetterLogEntry* TLetterLogIterator::AdoptLastEntry () { return (TLetterLogEntry*) fImplementation.AdoptLastEntry (); }
- inline const TLetterLogEntry* TLetterLogIterator::GetPreviousEntry () { return (const TLetterLogEntry*) fImplementation.GetPreviousEntry (); }
- inline TLetterLogEntry* TLetterLogIterator::AdoptPreviousEntry () { return (TLetterLogEntry*) fImplementation.AdoptPreviousEntry (); }
-
- /***********************************|****************************************/
-
- #pragma pop
-
- #endif // __LETTERLOG__
-